package com.qijian.maindata.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.common.annotation.Excel;
import com.qijian.common.core.domain.BaseEntity;

import java.util.List;

/**
 * 工艺线路对象 main_line
 *
 * @author qijian
 * @date 2021-09-03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("main_line")
public class Line extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "ID")
    private Long lineId;

    /**
     * 工艺线路编码
     */
    @Excel(name = "工艺线路编码")
    @ApiModelProperty(value = "工艺线路编码")
    private String lineCode;

    /**
     * 工艺线路名称
     */
    @Excel(name = "工艺线路名称")
    @ApiModelProperty(value = "工艺线路名称")
    private String lineName;

    /**
     * 工艺线路分类
     */
    @ApiModelProperty(value = "工艺线路分类")
    private String lineClassify;

    /**
     * 工艺线路版本
     */
    @Excel(name = "工艺线路版本")
    @ApiModelProperty(value = "工艺线路版本")
    private String lineVersion;

    /**
     * 是否默认
     */
    @Excel(name = "是否默认")
    @ApiModelProperty(value = "是否默认")
    private String isDefault;

    /**
     * 是否禁用
     */
    @Excel(name = "是否禁用")
    @ApiModelProperty(value = "是否禁用")
    private Boolean isDisabled;

    @TableField(exist = false)
    private List<LineBom> lineBomList;

    public static String buildLineName(String itemName, String drawingNo, String partNo) {
        return String.format("%s.%s(%s)", itemName, drawingNo, partNo);
    }
}
